﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace TranThiQuynhUyen
{
    /// <summary>
    /// Interaction logic for cau1.xaml
    /// </summary>
    public partial class cau1 : Window
    {
        int a;
        int b;
     
        public cau1()
        {
            InitializeComponent();
        }

        private void cong_Click_1(object sender, RoutedEventArgs e)
        {
            a = Convert.ToInt32(txtsoa.Text);
            b = Convert.ToInt32(txtsob.Text);
            txtkq.Text=Convert.ToString(a + b);
          
        }
        private void nhan_Click_1(object sender, RoutedEventArgs e)
        {
            a = Convert.ToInt32(txtsoa.Text);
            b = Convert.ToInt32(txtsob.Text);
            txtkq.Text = Convert.ToString(a * b);
        }

        private void chia_Click_1(object sender, RoutedEventArgs e)
        {
            float a = Convert.ToInt32(txtsoa.Text);
           float b = Convert.ToInt32(txtsob.Text);
          
            if (b == 0)
                MessageBox.Show("Không chia hết cho 0");
            else
                txtkq.Text = Convert.ToString(a / b);

        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {

            if(MessageBox.Show(" bạn có muốn thoát không?", "THÔNG BÁO", MessageBoxButton.YesNo)==MessageBoxResult.Yes)
    
               this.Close();
        }

        private void tru_Click_2(object sender, RoutedEventArgs e)
        {
            a = Convert.ToInt32(txtsoa.Text);
            b = Convert.ToInt32(txtsob.Text);
            txtkq.Text = Convert.ToString(a - b);
        }

        private void re_Click_1(object sender, RoutedEventArgs e)
        {
            txtsoa.Text = "";
            txtsob.Text = "";
            txtkq.Text = "";
            txtsoa.Focus();
        }
    }
}
